import { createRouter, createWebHistory } from 'vue-router'
import LayoutView from '@/views/LayoutView.vue'
import HomeView from '../views/HomeView/HomeView.vue'
import PlaceView from "../views/PlaceView/PlaceView.vue"
import PersonView from '@/views/PersonView/PersonView.vue'
import ShopView from '@/views/ShopView/ShopView.vue'
import MineView from '@/views/MineView/MineView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:"/",
      name:"layout",
      component:LayoutView,
      children:[
        {
          path: '/',
          name: 'home',
          component: HomeView
        },
        {
          path: '/place',
          name: 'place',
          component: PlaceView
        },
        {
          path: '/shop',
          name: 'shop',
          component: ShopView
        },
        {
          path: '/person',
          name: 'person',
          component: PersonView
        },
        {
          path: '/mine',
          name: 'mine',
          component: MineView
        }
      ]
    },
    {
      path:"/login",
      name:"login",
      component:() => import("../views/LoginView/LoginView.vue")
    },
    {
      path:"/register",
      name:"register",
      component:() => import("../views/LoginView/RegisterView.vue")
    },
    {
      path:"/city",
      name:"city",
      component:() => import("../views/HomeView/CityView.vue")
    },
    {
      path:"/beauty",
      name:"beauty",
      component:() => import("../views/HomeView/BeautyInfoView.vue")
    },
    {
      path:"/placedetails/:id",
      name:"placedetails",
      component:() => import("../views/PlaceView/PlaceDetailsView.vue")
    },
    {
      path:"/placemap",
      name:"placemap",
      component:() => import("../views/PlaceView/PlaceMapView.vue")
    },
    {
      path:"/persondetails/:id",
      name:"persondetails",
      component:() => import("../views/PersonView/PersonDetailsView.vue"),
      meta: { requiresAuth: true }
    },
    {
      path:"/minedata",
      name:"minedata",
      component:() => import("../views/MineView/MineDataView.vue"),
      meta: { requiresAuth: true }
    },
    {
      path:"/mineset",
      name:"mineset",
      component:() => import("../views/MineView/MineSetView.vue"),
      meta: { requiresAuth: true }
    },
    {
      path:"/mineaccount",
      name:"mineaccount",
      component:() => import("../views/MineView/MineAccountView.vue"),
      meta: { requiresAuth: true }
    },
    {
      path:"/order/:index",
      name:"order",
      component:() => import("../views/OrderView/OrderView.vue"),
      meta: { requiresAuth: true }
    },
    {
      path:"/goodsdetails/:id",
      name:"goodsdetails",
      component:() => import("../views/GoodsView/GoodsDetails.vue")
    },
    {
      path:"/comment",
      name:"comment",
      component:() => import("../views/GoodsView/CommentListView.vue")
    },
    {
      path:"/pay/:orderNo/:id",
      name:"pay",
      component:() => import("../views/PayView/PayView.vue")
    }
  ]
})

export default router
